﻿using System;
using System.IO;
using System.Web;
using System.Web.UI.HtmlControls;

public partial class System_Controls_FieldTemplates_FileUpload : System.Web.UI.UserControl
{
    byte[] _Value;
    string _ValueType;

    public string Title
    {
        get { return lb_Title.Text; }
        set { lb_Title.Text = value; }
    }
    public byte[] Value
    {
        get { return _Value; }
        set { _Value = value; }
    }
    public string ValueType
    {
        get { return _ValueType; }
        set { _ValueType = value; }
    }
    public bool IsReq
    {
        get { return rfv.Enabled; }
        set { rfv.Enabled = value; }
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (fu1.HasFile)
        {
            Stream imgStream = fu1.PostedFile.InputStream;
            int imgLen = fu1.PostedFile.ContentLength;
            _ValueType = fu1.PostedFile.ContentType;
            byte[] imgBinaryData = new byte[imgLen];

            int n = imgStream.Read(imgBinaryData, 0, imgLen);
            _Value = imgBinaryData;
        }
    }
}